<?php
/**
 * Created by PhpStorm.
 * UserModel: Administrator
 * Date: 2018/9/1
 * Time: 14:09
 */
namespace app\api\controller;

use app\petrol\model\PetrolUser;
use think\Controller;
use think\Session;

/**
 * Class BaseController
 * @package app\api\controller
 */
class BaseController extends Controller
{

    public function __construct()
    {
        header('Access-Control-Allow-Origin:*');
        parent::__construct();
        $state = tpConfig('State');
        if($state == 0){
            AjaxReturn(-3,'网站因'.tpConfig('Nodesc').'已暂时关闭');
        }
        $this->sessionId();
    }

    public function sessionId()
    {
        $id = Session::get('uid');
        if(empty($id)){
            AjaxReturn(-2,'暂未登录');
        }else{
            return true;
        }
    }}